﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using log4net;

namespace Common.Logger
{
    public class DNPCLogger : IDNPCLogger
    {
        private readonly log4net.ILog _logger;

        static DNPCLogger()
        {
            log4net.Config.XmlConfigurator.Configure();
        }

        public DNPCLogger(Type type)
        {
            _logger = LogManager.GetLogger(type);
        }

        public DNPCLogger(string dname)
        {
            _logger = LogManager.GetLogger(dname);
        }

        public void LogException(string message)
        {
            _logger.Error(message);
        }

        public void LogException(string message, Exception ex)
        {
            _logger.Error(message, ex);
        }

        public void LogException(Exception ex)
        {
            _logger.Error(ex);
        }

        public void LogFatal(string message)
        {
            _logger.Fatal(message);
        }

        public void LogFatal(string message, Exception ex)
        {
            _logger.Fatal(message, ex);
        }

        public void LogFatal(Exception ex)
        {
            _logger.Fatal(ex);
        }

        public void LogInfo(string message)
        {
            _logger.Info(message);
        }

        public void LogDebugInfo(string message)
        {
            _logger.Debug(message);
        }

        public void LogWarning(string message)
        {
            _logger.Warn(message);
        }
    }

}
